﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using LapvBussiness;

namespace Lapv.usercontrol
{
    public partial class Mainmenu : System.Web.UI.UserControl
    {
        public int SelectedTabIndex { get; set; }
        public string domainStyle = ConfigLapv.Instance.DomainStyle;
        public string domain =ConfigLapv.Instance.DomainAdmin;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Url.GetLeftPart(UriPartial.Authority) != null)
            {
                string url = Request.Url.GetLeftPart(UriPartial.Path).ToString();
                if (url.IndexOf("Default.aspx") > 0)
                {

                    SelectedTabIndex = 0;
                }
                 
                else if (url.IndexOf("CateManager.aspx") > 0)
                {

                    SelectedTabIndex = 2;
                }
                else if (url.IndexOf("CateAdd.aspx") > 0)
                {

                    SelectedTabIndex = 3;
                }
                else if (url.IndexOf("NewsManager.aspx") > 0)
                {

                    SelectedTabIndex = 4;
                }
                else if (url.IndexOf("NewsAdd.aspx") > 0)
                {

                    SelectedTabIndex = 5;
                }
                else if (url.IndexOf("SurveyManager.aspx") > 0)
                {

                    SelectedTabIndex = 6;
                }
                else if (url.IndexOf("Surveyadd.aspx") > 0)
                {

                    SelectedTabIndex = 7;
                }
                else if (url.IndexOf("RoleAdd.aspx") > 0)
                {

                    SelectedTabIndex = 8;
                }
                else if (url.IndexOf("PermissionAdd.aspx") > 0)
                {

                    SelectedTabIndex = 9;
                }
                else if (url.IndexOf("AccAdd.aspx") > 0)
                {

                    SelectedTabIndex = 10;
                }
                else if (url.IndexOf("AccMN.aspx") > 0)
                {

                    SelectedTabIndex =11;
                }
                else if (url.IndexOf("ChangePass.aspx") > 0)
                {

                    SelectedTabIndex = 12;
                }
                else if (url.IndexOf("Logout.aspx") > 0)
                {

                    SelectedTabIndex = 13;
                } 
            }

        }
        public string getCurrentCss(int _tabIndex)
        {
            if (_tabIndex == SelectedTabIndex)
                return "active";
            return "";
        }
    }
}